Skip to content

fix(engine): trim attempt-id slug after truncation - #7551

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
james3773:fix/slugify-attempt-id-trailing-dot
Jul 20, 2026
Merged

fix(engine): trim attempt-id slug after truncation#7551
JSONbored merged 1 commit into
JSONbored:mainfrom
james3773:fix/slugify-attempt-id-trailing-dot

Conversation

@james3773

Copy link
Copy Markdown
Contributor

Summary

slugifyAttemptId trimmed leading/trailing -/. before the 64-char slice, so a long attempt id whose 64th character was . (or -) produced a git-ref-invalid worktree branch name ending in that separator. Trim again after truncation so planWorktree / addWorktree never build a git worktree add -b ref that fails check-ref-format.

Closes #7528

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck (@loopover/engine package tsc build; workspace root typecheck needs a full workspace build first)
  • npx vitest run --coverage test/unit/worktree-plan.test.tsworktree-plan.ts at 100% lines and 100% branches in lcov (global threshold N/A for single-file run); codecov/patch should cover the changed slugify path
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Engine-only change under packages/loopover-engine + test/unit/worktree-plan.test.ts. Skipped UI/MCP/workers/actionlint/audit — no matching path changes. Full npm run test:ci omitted in favor of targeted critical checks for this leaf fix.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — no visible UI, frontend, docs, or extension changes.

Notes

Regression cases cover post-truncation trim firing (trailing . and -), clean non-separator truncation (no-op), and the empty-slug invalid_attempt_id throw path.

Reorder slugifyAttemptId so leading/trailing '-' and '.' are stripped after the 64-char cap, preventing git-invalid worktree branch names that end in '.'.

Co-authored-by: Cursor <cursoragent@cursor.com>
@james3773
james3773 requested a review from JSONbored as a code owner July 20, 2026 21:46
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 20, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.47%. Comparing base (1a019ab) to head (6eda1ef).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7551      +/-   ##
==========================================
- Coverage   88.47%   88.47%   -0.01%     
==========================================
  Files         720      720              
  Lines       75733    75733              
  Branches    22548    22548              
==========================================
- Hits        67008    67004       -4     
  Misses       7679     7679              
- Partials     1046     1050       +4     
Flag Coverage Δ
shard-1 32.99% <0.00%> (-0.05%) ⬇️
shard-2 36.85% <100.00%> (ø)
shard-3 25.66% <0.00%> (ø)
shard-4 38.88% <100.00%> (ø)
shard-5 34.21% <0.00%> (ø)
shard-6 36.22% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ackages/loopover-engine/src/miner/worktree-plan.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 20, 2026
@loopover-orb

loopover-orb Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-20 22:06:10 UTC

2 files · 1 AI reviewer · no blockers · CI green · unstable

⏸️ Suggested Action - Manual Review

Review summary
The fix correctly reorders operations: trim separators, then truncate at MAX_SLUG_LENGTH, then trim separators again, which properly handles the case where truncation lands on a `.` or `-`. The logic is sound — a post-truncation trailing separator is now stripped — and the added tests directly exercise the reported boundary case (63 safe chars + separator + overflow) plus a clean-boundary regression check. This is a minimal, well-targeted leaf fix tied to an open issue.

Nits — 3 non-blocking
  • worktree-plan.ts:39-49: the double `.replace(/^[-.]+|[-.]+$/g, "")` (pre- and post-truncation) is slightly redundant since the second pass alone would suffice if the first pass didn't exist — the comment does explain why both are needed, so this is a very minor DRY nit, not worth blocking on.
  • The new tests use string repetition to construct fixtures (`"a".repeat(63)`), which is fine but could be marginally clearer with a named helper if this pattern recurs elsewhere in the suite.
  • Consider a table-driven test (e.g. `it.each`) for the trailing-separator cases in worktree-plan.test.ts to reduce near-duplicate test bodies for '.' vs '-' truncation.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7528
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 862 registered-repo PR(s), 609 merged, 82 issue(s).
Contributor context ✅ Confirmed Gittensor contributor james3773; Gittensor profile; 862 PR(s), 82 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: james3773
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Rust, MDX, Clojure, Cuda, Dart
  • Official Gittensor activity: 862 PR(s), 82 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@JSONbored
JSONbored merged commit ed183a3 into JSONbored:main Jul 20, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(engine): slugifyAttemptId's trim-then-truncate order can produce a git-invalid worktree branch name ending in "."

2 participants